More idiomatic, and avoids accidental failure to check caller
privilege. For example, the unmap path was not checking for any
privilege before calling unmap_domain_pirq_emuirq(), which can't be
right.
Signed-off-by: Keir Fraser <keir@xen.org>
struct msi_info _msi;
void *map_data = NULL;
- if ( !map )
- return -EINVAL;
-
- d = (map->domid == DOMID_SELF) ? rcu_lock_current_domain()
- : rcu_lock_domain_by_id(map->domid);
-
- if ( d == NULL )
- return -ESRCH;
+ ret = rcu_lock_target_domain_by_id(map->domid, &d);
+ if ( ret )
+ return ret;
if ( map->domid == DOMID_SELF && is_hvm_domain(d) )
{
struct domain *d;
int ret;
- d = (unmap->domid == DOMID_SELF) ? rcu_lock_current_domain()
- : rcu_lock_domain_by_id(unmap->domid);
-
- if ( d == NULL )
- return -ESRCH;
+ ret = rcu_lock_target_domain_by_id(unmap->domid, &d);
+ if ( ret )
+ return ret;
if ( is_hvm_domain(d) )
{